#include <iostream>
#define N 100

using namespace std;

void prime_factors(int array[], int elements){
int i, j, divisor, number, nr;
for(i=0;i<elements;i++){
    number=array[i];
    divisor=2;
    cout<<array[i]<<"= ";
    while(number!=1){
        if(number%divisor==0){
            nr=0;
            cout<<divisor<<"^";
            while(number%divisor==0){
                number/= divisor;
                ++nr;}
            cout<<nr<<" ";}
        ++divisor;}
    cout<<"\n";}
}

void readintVector(int array[], int elements){
for (int i=0; i<elements; i++){
	cout<<"a["<<i<<"]=";
	cin>>array[i];
	cout<<"\n";}
}

int main(){
int array[N];
int elements;

cout<<"Type the number of elements you want in the array: ";
cin>>elements;

readintVector(array, elements);

cout<<"The original array is ";
for(int i=0; i<elements; i++){
	cout<<array[i]<<" ";}
cout<<endl;

cout<<"The elements decomposed into prime factors are: "<< endl;
prime_factors(array, elements);

return 0;
}
